package com.duguo.dynamicmvc.demo.owner;

import javax.servlet.http.HttpServletRequest;

import com.duguo.dynamicmvc.demo.owner.domain.Owner;
import com.duguo.dynamicmvc.demo.owner.domain.OwnerImpl;
import com.duguo.dynamicmvc.model.Model;
import com.duguo.dynamicmvc.model.statusmessage.StatusMessageImpl;
import com.duguo.dynamicmvc.model.statusmessage.StatusMessageModel;
import com.duguo.dynamicmvc.model.validator.exception.ValidationException;
import com.duguo.dynamicmvc.view.View;

public class OwnerController{

    public Owner resolve(HttpServletRequest request,String namespace){
    	if(namespace.length()>=5){
    		return new OwnerImpl(System.currentTimeMillis(),namespace);
    	}
        return null;
    }

    public View hello(Model model, View view) throws ValidationException{
    	((StatusMessageModel)model).addStatusMessage(new StatusMessageImpl("From hello method!"));
        return view;
    }

    public void noreturnview(Model model){
    	((StatusMessageModel)model).addStatusMessage(new StatusMessageImpl("From noreturnview!"));
    }
}
